/**
 * 文件名：WidgetCategoryImpl.java
 *
 * 版本信息：v1.0
 * 日期：2013-6-19
 * Copyright  Corporation 2013 
 * 版权所有
 *
 */

package com.foreveross.bsl.mam.rbac.application.impl;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import com.foreveross.bsl.common.utils.bean.BeanHelper;
import com.foreveross.bsl.mam.app.application.SettingCategoryApplication;
import com.foreveross.bsl.mam.app.application.vo.SettingCategoryVo;
import com.foreveross.bsl.mam.rbac.application.UserCategoryApplication;
import com.foreveross.bsl.mam.rbac.application.vo.UserCategoryVO;

/**
 * 此类描述的是：用户类别接口实现类
 * 
 * @author: panhm@foreveross.com
 * @version: 2013-6-19 下午3:04:29
 */
@Named("userCategoryApplication")
public class UserCategoryApplicationImpl implements UserCategoryApplication {

	@Inject
	private SettingCategoryApplication settingCategoryApplication;

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.foreveross.bsl.mam.application.WidgetCategoryInf#findAll()
	 */

	@Override
	public List<UserCategoryVO> findAll() {
		// TODO Auto-generated method stub
		List<SettingCategoryVo> list = settingCategoryApplication.findByType(
				"3", "1"); // 获取模块类别
		List<UserCategoryVO> result = new ArrayList<UserCategoryVO>();
		if (list != null) {
			UserCategoryVO vo;
			for (SettingCategoryVo settingvo : list) {
				vo = new UserCategoryVO();
				BeanHelper.copyProperties(vo, settingvo);
				result.add(vo);
			}
		}
		return result;
	}

	@Override
	public UserCategoryVO getEntity(String id) {
		// TODO Auto-generated method stub
		SettingCategoryVo settingvo = settingCategoryApplication.getEntity(id);
		UserCategoryVO vo = new UserCategoryVO();
		BeanHelper.copyProperties(vo, settingvo);
		return vo;
	}

}
